package com.jcl.recruit.resume.service;

import com.jcl.core.web.utils.RequestUtils;
import com.jcl.recruit.log.model.ResumeLog;
import com.jcl.recruit.resume.logic.ResumeBasicInfoLogic;
import com.jcl.recruit.resume.logic.ResumeOperateLogic;
import com.jcl.recruit.resume.model.ResumeBasicInfo;
import com.jcl.recruit.server.elastic.SearchResumeServer;
import com.jcl.recruit.server.elastic.vo.SearchResumeBasicEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @ClassName ResumeOperateService

 * @Author yyliu
 * @Date 2018/9/17 11:03
 * @Version 1.0
 **/
@Service
public class ResumeOperateService {

    @Autowired
    private ResumeOperateLogic resumeOperateLogic;
    @Autowired
    private ResumeBasicInfoLogic resumeBasicInfoLogic;
    @Autowired
    private SearchResumeServer searchResumeServer;

    public List<ResumeLog> findSearchList(Integer resumeId) {

        String corpCode = RequestUtils.getCorpCode();
        SearchResumeBasicEntity searchResume = searchResumeServer.findResumeBasicEntity(resumeId);
        if (null != searchResume) {
            ResumeBasicInfo resume = resumeBasicInfoLogic.findOneByExternalKey(corpCode, searchResume.getId().toString());
            if (null != resume) {
                resumeId = resume.getId();
            }
        }
        return resumeOperateLogic.findList(resumeId);
    }

    public List<ResumeLog> findList(Integer resumeId) {
        return resumeOperateLogic.findList(resumeId);
    }

    public int insert(ResumeLog record) {
        return resumeOperateLogic.insert(record);
    }
}
